﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using LGE;

namespace MagicFight
{
    public class DrainAura : Effect
    {
        public double lifeTime = 0;
        public int maxLifeTime = 400;
        Texture2D texture;
        float scale = 1f;
        Vector2 origin;

        public DrainAura(Vector2 pos)
            : base(pos)
        {
            texture = Engine.Load<Texture2D>("Images\\Magic\\Counter_Aura");
            origin = new Vector2(texture.Width / 2, texture.Height / 2);
        }

        public override void Update(GameTime gameTime)
        {
            lifeTime += gameTime.ElapsedGameTime.TotalMilliseconds;
            if (lifeTime>maxLifeTime) alive = false;
            scale = (float)lifeTime / (float)maxLifeTime;
            if (scale > 1) scale = 1;
        }

        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture, position, null, Color.White, scale, origin, 1 - scale, SpriteEffects.None, 0);
            spriteBatch.Draw(texture, position, null, Color.White, scale, origin, 1 - scale - 0.1f, SpriteEffects.FlipVertically, 0);
            spriteBatch.Draw(texture, position, null, Color.White, scale, origin, 1 - scale - 0.2f, SpriteEffects.FlipHorizontally, 0);
            spriteBatch.Draw(texture, position, null, Color.White, scale, origin, 1 - scale - 0.3f, SpriteEffects.None, 0);
        }
    }
}

 

